import { createWebHashHistory, createRouter } from 'vue-router';

import HomeView from '../views/HomeView.vue';
import AboutView from '../views/AboutView.vue';

export const routes = [
  {
    path: '/',
    name: '首页',
    component: HomeView,
  },
  {
    path: '/less',
    name: 'less',
    component: () => import('../views/lessDemo/index.vue'),
    children: [
      {
        path: '',
        redirect: '/less/extend',
      },
      {
        path: 'extend',
        name: 'extend',
        component: () => import('../views/lessDemo/Extend.vue'),
      },
    ],
  },
  {
    path: '/echarts',
    name: 'echarts',
    component: () => import('../views/echarts/index.vue'),
  },
  {
    path: '/about',
    name: '关于',
    component: AboutView,
  },
  {
    path: '/table',
    name: '表格',
    component: () => import('../views/TableView.vue'),
  },
  {
    path: '/todo',
    name: 'todo',
    component: () => import('../views/TodoListView.vue'),
  },
  {
    path: '/screen',
    name: '全屏',
    component: () => import('../views/ScreenView.vue'),
  },
  {
    path: '/options',
    name: '选项',
    component: () => import('../views/OptionsView.vue'),
  },
  {
    path: '/codeMirror',
    name: 'code mirror',
    component: () => import('../views/CodeMirrorView.vue'),
  },
  {
    path: '/tinymce',
    name: 'tinymce',
    component: () => import('../views/TinymceView.vue'),
  },
  {
    path: '/colorView',
    name: 'colorView',
    component: () => import('../views/ColorView/index.vue'),
  },
  {
    path: '/topologyView',
    name: 'topologyView',
    component: () => import('../views/topologyView/index.vue'),
  },
  {
    path: '/horizontalDragMenu',
    name: 'horizontalDragMenu',
    component: () => import('../views/HorizontalDragMenu/index.vue'),
  },
  {
    path: '/fabricView',
    name: 'fabricView',
    component: () => import('../views/fabric/index.vue'),
    children: [
      {
        path: 'hello',
        name: 'hello',
        component: () => import('../views/fabric/hello.vue'),
      },
      {
        path: 'topology',
        name: 'topology',
        component: () => import('../views/fabric/topology.vue'),
      },
    ],
  },
  {
    path: '/testElementPlus',
    name: 'testElementPlus',
    component: () => import('../views/TestElementPlus.vue'),
  },
  {
    path: '/world',
    name: 'world',
    component: () => import('../views/worldMapView/index.vue'),
  },
];

export const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
